import { useRouter } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
export function mapToMenu(name: string) {
  const $router = useRouter()
  const routes = $router.options.routes
  let routeArr: any[] = []
  routeArr = routes.find((item) => item.name == name && item.children)
    ?.children as RouteRecordRaw[]

  return routeArr
}
